package example.array;

import java.util.Arrays;

/**
 * Created by lenovo on 2016/11/4 0004.
 * Array.fill(arrayname,value) 方法和
 * Array.fill(arrayname ,starting index ,ending index ,value) 方法向数组中填充元素
 */
public class FillArray {
    public static void main(String[] args) {
        int array[] = new int[6];
        Arrays.fill(array, 100);
        for (int anArray : array) {
            System.out.println(anArray);
        }
        System.out.println("===============");
        Arrays.fill(array, 3, 6, 50);

        for (int i = 0, n = array.length; i < n; i++) {
            System.out.println(array[i]);
        }
    }
}
